//
//  YHJMyCenterViewController.m
//  Youhuiju
//
//  Created by yutenys on 16/7/13.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "YHJMyCenterViewController.h"
#import "InformationTableViewCell.h"
#import "OrderformTableViewCell.h"
#import "AssetsTableViewCell.h"
#import "CollectTableViewCell.h"
#import "SetUpController.h"
@interface YHJMyCenterViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong)UITableView *tableView;
@property (nonatomic, strong)NSMutableArray *arr;

@end



@implementation YHJMyCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
//    self.title = @"个人中心";
    // Do any additional setup after loading the view.
    self.navigationController.navigationBar.hidden = YES;
   // self.view.backgroundColor = [UIColor redColor];
    [self createTableView];
    
}
- (void)createTableView {
    if (!_tableView) {
        self.tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
        _tableView.backgroundColor = [UIColor colorWithHexString:@"eaeaea"];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        self.tableView.separatorStyle =NO;
        [_tableView registerNib:[UINib nibWithNibName:@"InformationTableViewCell" bundle:nil] forCellReuseIdentifier:@"personalcenter"];
        
        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"pool"];
        [_tableView registerNib:[UINib nibWithNibName:@"OrderformTableViewCell" bundle:nil] forCellReuseIdentifier:@"OrderformTableViewCell"];
       
        [_tableView registerNib:[UINib nibWithNibName:@"CollectTableViewCell" bundle:nil] forCellReuseIdentifier:@"CollectTableViewCell"];
        [_tableView registerNib:[UINib nibWithNibName:@"AssetsTableViewCell" bundle:nil] forCellReuseIdentifier:@"AssetsTableViewCell"];
        
        _tableView.scrollEnabled =NO;
        
        [self.view addSubview:_tableView];
    }
    
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.bottom.equalTo(self.view.mas_bottom).offset(-49);
        
    }];
    
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    if (section == 0) {
        return 0*FitH;
    }
    else {
        return 10*FitH;
        
    }
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    if (section == 0) {
        return 2;
    }else {
        return   1;
    }
    
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    switch (indexPath.section) {
        case 0:
            if (indexPath.row == 0) {
                InformationTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"personalcenter"];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                return cell;
            }else {
               
                
                
                OrderformTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"OrderformTableViewCell"];
                cell.selectionStyle = UITableViewCellSelectionStyleNone;
                return cell;
            }
            break;
        case 1:{

            AssetsTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AssetsTableViewCell"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
            
            
        }
            break;
        case 2:{
            CollectTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CollectTableViewCell"];
            cell.selectionStyle = UITableViewCellSelectionStyleNone;
            return cell;
            
        }
            break;
        default:{
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"pool"];
            return cell;
        }
            
            
            break;
    }
    
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section==0) {
        if (indexPath.row==0) {
            return 164*FitH;
        }else {
            return 113*FitH;
        }
        
        
    }else if (indexPath.section == 1){
        return 113*FitH;
    }else {
        return 250*FitH;
    }
    
    
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
